3.2.5 \(\int \frac {\cot ^2(e+f x)}{\sqrt {a+a \sin (e+f x)}} \, dx\) [105]

Optimal. Leaf size=62 \[ \frac {\tanh ^{-1}\left (\frac {\sqrt {a} \cos (e+f x)}{\sqrt {a+a \sin (e+f x)}}\right )}{\sqrt {a} f}-\frac {\cot (e+f x)}{f \sqrt {a+a \sin (e+f x)}} \]

[Out]

arctanh(cos(f*x+e)*a^(1/2)/(a+a*sin(f*x+e))^(1/2))/f/a^(1/2)-cot(f*x+e)/f/(a+a*sin(f*x+e))^(1/2)

________________________________________________________________________________________

Rubi [A]
time = 0.07, antiderivative size = 62, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 4, integrand size = 23, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.174, Rules used = {2795, 21, 2852, 212} \begin {gather*} \frac {\tanh ^{-1}\left (\frac {\sqrt {a} \cos (e+f x)}{\sqrt {a \sin (e+f x)+a}}\right )}{\sqrt {a} f}-\frac {\cot (e+f x)}{f \sqrt {a \sin (e+f x)+a}} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[Cot[e + f*x]^2/Sqrt[a + a*Sin[e + f*x]],x]

[Out]

ArcTanh[(Sqrt[a]*Cos[e + f*x])/Sqrt[a + a*Sin[e + f*x]]]/(Sqrt[a]*f) - Cot[e + f*x]/(f*Sqrt[a + a*Sin[e + f*x]
])

Rule 21

Int[(u_.)*((a_) + (b_.)*(v_))^(m_.)*((c_) + (d_.)*(v_))^(n_.), x_Symbol] :> Dist[(b/d)^m, Int[u*(c + d*v)^(m +
 n), x], x] /; FreeQ[{a, b, c, d, n}, x] && EqQ[b*c - a*d, 0] && IntegerQ[m] && ( !IntegerQ[n] || SimplerQ[c +
 d*x, a + b*x])

Rule 212

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[-b, 2]))*ArcTanh[Rt[-b, 2]*(x/Rt[a, 2])], x]
 /; FreeQ[{a, b}, x] && NegQ[a/b] && (GtQ[a, 0] || LtQ[b, 0])

Rule 2795

Int[((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)/tan[(e_.) + (f_.)*(x_)]^2, x_Symbol] :> Simp[-(a + b*Sin[e +
f*x])^m/(f*Tan[e + f*x]), x] + Dist[1/a, Int[(a + b*Sin[e + f*x])^m*((b*m - a*(m + 1)*Sin[e + f*x])/Sin[e + f*
x]), x], x] /; FreeQ[{a, b, e, f, m}, x] && EqQ[a^2 - b^2, 0] && IntegerQ[m - 1/2] &&  !LtQ[m, -1]

Rule 2852

Int[Sqrt[(a_) + (b_.)*sin[(e_.) + (f_.)*(x_)]]/((c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)]), x_Symbol] :> Dist[-2*(
b/f), Subst[Int[1/(b*c + a*d - d*x^2), x], x, b*(Cos[e + f*x]/Sqrt[a + b*Sin[e + f*x]])], x] /; FreeQ[{a, b, c
, d, e, f}, x] && NeQ[b*c - a*d, 0] && EqQ[a^2 - b^2, 0] && NeQ[c^2 - d^2, 0]

Rubi steps

\begin {align*} \int \frac {\cot ^2(e+f x)}{\sqrt {a+a \sin (e+f x)}} \, dx &=-\frac {\cot (e+f x)}{f \sqrt {a+a \sin (e+f x)}}+\frac {\int \frac {\csc (e+f x) \left (-\frac {a}{2}-\frac {1}{2} a \sin (e+f x)\right )}{\sqrt {a+a \sin (e+f x)}} \, dx}{a}\\ &=-\frac {\cot (e+f x)}{f \sqrt {a+a \sin (e+f x)}}-\frac {\int \csc (e+f x) \sqrt {a+a \sin (e+f x)} \, dx}{2 a}\\ &=-\frac {\cot (e+f x)}{f \sqrt {a+a \sin (e+f x)}}+\frac {\text {Subst}\left (\int \frac {1}{a-x^2} \, dx,x,\frac {a \cos (e+f x)}{\sqrt {a+a \sin (e+f x)}}\right )}{f}\\ &=\frac {\tanh ^{-1}\left (\frac {\sqrt {a} \cos (e+f x)}{\sqrt {a+a \sin (e+f x)}}\right )}{\sqrt {a} f}-\frac {\cot (e+f x)}{f \sqrt {a+a \sin (e+f x)}}\\ \end {align*}

________________________________________________________________________________________

Mathematica [B] Leaf count is larger than twice the leaf count of optimal. \(138\) vs. \(2(62)=124\).
time = 0.23, size = 138, normalized size = 2.23 \begin {gather*} \frac {\csc \left (\frac {1}{4} (e+f x)\right ) \sec \left (\frac {1}{4} (e+f x)\right ) \left (-2 \cos \left (\frac {1}{2} (e+f x)\right )+2 \sin \left (\frac {1}{2} (e+f x)\right )+\left (\log \left (1+\cos \left (\frac {1}{2} (e+f x)\right )-\sin \left (\frac {1}{2} (e+f x)\right )\right )-\log \left (1-\cos \left (\frac {1}{2} (e+f x)\right )+\sin \left (\frac {1}{2} (e+f x)\right )\right )\right ) \sin (e+f x)\right ) \left (1+\tan \left (\frac {1}{2} (e+f x)\right )\right )}{8 f \sqrt {a (1+\sin (e+f x))}} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[Cot[e + f*x]^2/Sqrt[a + a*Sin[e + f*x]],x]

[Out]

(Csc[(e + f*x)/4]*Sec[(e + f*x)/4]*(-2*Cos[(e + f*x)/2] + 2*Sin[(e + f*x)/2] + (Log[1 + Cos[(e + f*x)/2] - Sin
[(e + f*x)/2]] - Log[1 - Cos[(e + f*x)/2] + Sin[(e + f*x)/2]])*Sin[e + f*x])*(1 + Tan[(e + f*x)/2]))/(8*f*Sqrt
[a*(1 + Sin[e + f*x])])

________________________________________________________________________________________

Maple [A]
time = 2.48, size = 103, normalized size = 1.66

method result size
default \(-\frac {\left (1+\sin \left (f x +e \right )\right ) \sqrt {-a \left (\sin \left (f x +e \right )-1\right )}\, \left (-\arctanh \left (\frac {\sqrt {a -a \sin \left (f x +e \right )}}{\sqrt {a}}\right ) a \sin \left (f x +e \right )+\sqrt {a -a \sin \left (f x +e \right )}\, \sqrt {a}\right )}{a^{\frac {3}{2}} \sin \left (f x +e \right ) \cos \left (f x +e \right ) \sqrt {a +a \sin \left (f x +e \right )}\, f}\) \(103\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cot(f*x+e)^2/(a+a*sin(f*x+e))^(1/2),x,method=_RETURNVERBOSE)

[Out]

-(1+sin(f*x+e))*(-a*(sin(f*x+e)-1))^(1/2)*(-arctanh((a-a*sin(f*x+e))^(1/2)/a^(1/2))*a*sin(f*x+e)+(a-a*sin(f*x+
e))^(1/2)*a^(1/2))/a^(3/2)/sin(f*x+e)/cos(f*x+e)/(a+a*sin(f*x+e))^(1/2)/f

________________________________________________________________________________________

Maxima [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Failed to integrate} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(f*x+e)^2/(a+a*sin(f*x+e))^(1/2),x, algorithm="maxima")

[Out]

integrate(cot(f*x + e)^2/sqrt(a*sin(f*x + e) + a), x)

________________________________________________________________________________________

Fricas [B] Leaf count of result is larger than twice the leaf count of optimal. 288 vs. \(2 (58) = 116\).
time = 0.38, size = 288, normalized size = 4.65 \begin {gather*} \frac {{\left (\cos \left (f x + e\right )^{2} - {\left (\cos \left (f x + e\right ) + 1\right )} \sin \left (f x + e\right ) - 1\right )} \sqrt {a} \log \left (\frac {a \cos \left (f x + e\right )^{3} - 7 \, a \cos \left (f x + e\right )^{2} + 4 \, {\left (\cos \left (f x + e\right )^{2} + {\left (\cos \left (f x + e\right ) + 3\right )} \sin \left (f x + e\right ) - 2 \, \cos \left (f x + e\right ) - 3\right )} \sqrt {a \sin \left (f x + e\right ) + a} \sqrt {a} - 9 \, a \cos \left (f x + e\right ) + {\left (a \cos \left (f x + e\right )^{2} + 8 \, a \cos \left (f x + e\right ) - a\right )} \sin \left (f x + e\right ) - a}{\cos \left (f x + e\right )^{3} + \cos \left (f x + e\right )^{2} + {\left (\cos \left (f x + e\right )^{2} - 1\right )} \sin \left (f x + e\right ) - \cos \left (f x + e\right ) - 1}\right ) + 4 \, \sqrt {a \sin \left (f x + e\right ) + a} {\left (\cos \left (f x + e\right ) - \sin \left (f x + e\right ) + 1\right )}}{4 \, {\left (a f \cos \left (f x + e\right )^{2} - a f - {\left (a f \cos \left (f x + e\right ) + a f\right )} \sin \left (f x + e\right )\right )}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(f*x+e)^2/(a+a*sin(f*x+e))^(1/2),x, algorithm="fricas")

[Out]

1/4*((cos(f*x + e)^2 - (cos(f*x + e) + 1)*sin(f*x + e) - 1)*sqrt(a)*log((a*cos(f*x + e)^3 - 7*a*cos(f*x + e)^2
 + 4*(cos(f*x + e)^2 + (cos(f*x + e) + 3)*sin(f*x + e) - 2*cos(f*x + e) - 3)*sqrt(a*sin(f*x + e) + a)*sqrt(a)
- 9*a*cos(f*x + e) + (a*cos(f*x + e)^2 + 8*a*cos(f*x + e) - a)*sin(f*x + e) - a)/(cos(f*x + e)^3 + cos(f*x + e
)^2 + (cos(f*x + e)^2 - 1)*sin(f*x + e) - cos(f*x + e) - 1)) + 4*sqrt(a*sin(f*x + e) + a)*(cos(f*x + e) - sin(
f*x + e) + 1))/(a*f*cos(f*x + e)^2 - a*f - (a*f*cos(f*x + e) + a*f)*sin(f*x + e))

________________________________________________________________________________________

Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \frac {\cot ^{2}{\left (e + f x \right )}}{\sqrt {a \left (\sin {\left (e + f x \right )} + 1\right )}}\, dx \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(f*x+e)**2/(a+a*sin(f*x+e))**(1/2),x)

[Out]

Integral(cot(e + f*x)**2/sqrt(a*(sin(e + f*x) + 1)), x)

________________________________________________________________________________________

Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 138 vs. \(2 (58) = 116\).
time = 10.74, size = 138, normalized size = 2.23 \begin {gather*} \frac {\sqrt {2} \sqrt {a} {\left (\frac {\sqrt {2} \log \left (\frac {{\left | -2 \, \sqrt {2} + 4 \, \sin \left (-\frac {1}{4} \, \pi + \frac {1}{2} \, f x + \frac {1}{2} \, e\right ) \right |}}{{\left | 2 \, \sqrt {2} + 4 \, \sin \left (-\frac {1}{4} \, \pi + \frac {1}{2} \, f x + \frac {1}{2} \, e\right ) \right |}}\right )}{a \mathrm {sgn}\left (\cos \left (-\frac {1}{4} \, \pi + \frac {1}{2} \, f x + \frac {1}{2} \, e\right )\right )} - \frac {4 \, \sin \left (-\frac {1}{4} \, \pi + \frac {1}{2} \, f x + \frac {1}{2} \, e\right )}{{\left (2 \, \sin \left (-\frac {1}{4} \, \pi + \frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} - 1\right )} a \mathrm {sgn}\left (\cos \left (-\frac {1}{4} \, \pi + \frac {1}{2} \, f x + \frac {1}{2} \, e\right )\right )}\right )}}{4 \, f} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(f*x+e)^2/(a+a*sin(f*x+e))^(1/2),x, algorithm="giac")

[Out]

1/4*sqrt(2)*sqrt(a)*(sqrt(2)*log(abs(-2*sqrt(2) + 4*sin(-1/4*pi + 1/2*f*x + 1/2*e))/abs(2*sqrt(2) + 4*sin(-1/4
*pi + 1/2*f*x + 1/2*e)))/(a*sgn(cos(-1/4*pi + 1/2*f*x + 1/2*e))) - 4*sin(-1/4*pi + 1/2*f*x + 1/2*e)/((2*sin(-1
/4*pi + 1/2*f*x + 1/2*e)^2 - 1)*a*sgn(cos(-1/4*pi + 1/2*f*x + 1/2*e))))/f

________________________________________________________________________________________

Mupad [F]
time = 0.00, size = -1, normalized size = -0.02 \begin {gather*} \int \frac {{\mathrm {cot}\left (e+f\,x\right )}^2}{\sqrt {a+a\,\sin \left (e+f\,x\right )}} \,d x \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cot(e + f*x)^2/(a + a*sin(e + f*x))^(1/2),x)

[Out]

int(cot(e + f*x)^2/(a + a*sin(e + f*x))^(1/2), x)

________________________________________________________________________________________